import numpy as np
import scipy.signal as signal

# 输入序列和参数序列
x = np.array([0.11, 0.22, 0.33, 0.44, 0.55, 0.66])
b = np.array([0.1, 0.2 , 0.3, 0.4])

# 计算
y_conv = signal.convolve(x, b) # 直接使用卷积函数
y_fir  = y_conv[:len(x)] # 仅保留同输入输入序列相同长度的卷积序列前半部分
y_corr = signal.convolve(x, np.flipud(b)) # 将参数序列b逆序之后传入卷积算式

# 打印结果
print(y_conv)
print(y_fir)
print(y_corr)

